home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / BCCollec / Structs / Maps / BCMapD.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  2.3 KB  |  72 lines  |  [TEXT/MPS ]

  1. //  The C++ Booch Components (Version 2.1)
  2. //  (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
  3. //
  4. //  BCMapD.h
  5. //
  6. //  This file contains the declaration of the dynamic map.
  7.  
  8. #ifndef BCMAPD_H
  9. #define BCMAPD_H 1
  10.  
  11. #include "BCNodes.h"
  12. #include "BCDynami.h"
  13. #include "BCHashTa.h"
  14. #include "BCMap.h"
  15.  
  16. // Dynamic map
  17.  
  18. template<class Item, class Value, BC_Index Buckets, class StorageManager>
  19. class BC_TDynamicMap : public BC_TMap<Item, Value> {
  20. public:
  21.  
  22.   BC_TDynamicMap();
  23.   BC_TDynamicMap(BC_Index (*)(const Item&));
  24.   BC_TDynamicMap(BC_Index chunkSize);
  25.   BC_TDynamicMap(const BC_TDynamicMap<Item, Value, Buckets, StorageManager>&);
  26.   virtual ~BC_TDynamicMap();
  27.  
  28.   virtual BC_TMap<Item, Value>& operator=(const BC_TMap<Item, Value>&);
  29.   virtual BC_TMap<Item, Value>&
  30.     operator=(const BC_TDynamicMap<Item, Value, Buckets, StorageManager>&);
  31.   virtual BC_Boolean operator==(const BC_TMap<Item, Value>&) const;
  32.   virtual BC_Boolean 
  33.     operator==(const BC_TDynamicMap<Item, Value, Buckets, StorageManager>&) const;
  34.   BC_Boolean 
  35.     operator!=(const BC_TDynamicMap<Item, Value, Buckets, StorageManager>&) const;
  36.  
  37.   virtual void SetHashFunction(BC_Index (*)(const Item&));
  38.   virtual void SetChunkSize(BC_Index chunkSize);
  39.   virtual void Clear();
  40.   virtual void Preallocate(BC_Index new_length);
  41.   virtual BC_Boolean Bind(const Item&, const Value&);
  42.   virtual BC_Boolean Rebind(const Item&, const Value&);
  43.   virtual BC_Boolean Unbind(const Item&);
  44.  
  45.   virtual BC_Index ChunkSize() const;
  46.   virtual BC_Index Extent() const;
  47.   virtual BC_Boolean IsEmpty() const;
  48.   virtual BC_Boolean IsBound(const Item&) const;
  49.   virtual const Value* ValueOf(const Item&) const;
  50.   virtual Value* ValueOf(const Item&);
  51.  
  52.   static void* operator new(size_t);
  53.   static void operator delete(void*, size_t);
  54.  
  55. protected:
  56.  
  57.   BC_TTable<Item, Value, Buckets, BC_TDynamic<BC_TPair<Item, Value>, StorageManager> > 
  58.     fRep;
  59.  
  60.   virtual void Purge();
  61.   virtual BC_Boolean Attach(const Item&, const Value&);
  62.   virtual BC_Index Cardinality() const;
  63.   virtual BC_Index NumberOfBuckets() const;
  64.   virtual BC_Index Length(BC_Index bucket) const;
  65.   virtual BC_Boolean Exists(const Item&) const;
  66.   virtual const Item& ItemAt(BC_Index bucket, BC_Index index) const;
  67.   virtual const Value& ValueAt(BC_Index bucket, BC_Index index) const;
  68.  
  69. };
  70.  
  71. #endif
  72.